Skip to content

Routers#11

Open
Palezehvat wants to merge 11 commits intomasterfrom
Routers
Open

Routers#11
Palezehvat wants to merge 11 commits intomasterfrom
Routers

Conversation

@Palezehvat
Copy link
Owner

Дз по роутерам

Copy link

@yurii-litvinov yurii-litvinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно было обойтись в три раза меньшим количеством строк кода. И оооочень неаккуратно.

/// Returns graph size
/// </summary>
/// <returns>Graph size</returns>
/// <exception cref="NullPointerException">If graph null throw exception</exception>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так он не null, а пустой :)

{
if (IsEmpty())
{
throw new NullPointerException();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут та же проблема, я как пользователь хочу знать, в чём я неправ и как это исправить. NullPointerException мне никак в этом не поможет, тем более что в C# нет pointer-ов.

{
throw new NullPointerException();
}
return GraphByList.sizeGraph;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nullability недоволен, надо поправить

/// </summary>
/// <returns>Graph size</returns>
/// <exception cref="NullPointerException">If graph null throw exception</exception>
public int ReturnSizeGraph()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это лучше было сделать свойством, причём просто Size

/// <param name="sizeWay">Path Size</param>
public void AddArcs(int fromVertex, int toVertex, int sizeWay)
{
if(GraphByList == null)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(GraphByList == null)
if (GraphByList == null)

/// <exception cref="InvalidFileException">Throws an exception if the entry in the file is uncorrected</exception>
public bool WorkWithFile(string filePath, string fileAfter)
{
var file = new StreamReader(filePath);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var file = new StreamReader(filePath);
using var file = new StreamReader(filePath);

++i;
while (Char.IsDigit(line[i]))
{
mainVertex = mainVertex * 10 + line[i] - 48;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используйте int.TryParse

using Routers;
public class Tests
{
Graph graph;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Graph graph;
private Graph graph;

Comment on lines 3 to 4
using Routers;
public class Tests

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
using Routers;
public class Tests
using Routers;
public class Tests

private static IEnumerable<TestCaseData> GraphForTest
=> new TestCaseData[]
{
new TestCaseData(new Graph()),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments